package interview.prefix;

import java.util.Scanner;

/**
 * 塔子哥抓敌人 https://codefun2000.com/p/P1087
 * 参考：https://www.bilibili.com/video/BV1ja4y1F7Fk/
 */
public class RegionCatch {

    /**
     * 思路：二维前缀和。矩形[(0,0), (x,y)]的和r[x][y] = r[x-1][y] + r[x][y-1] - r[x-1][y-1] + r[x][y];
     * 矩形[(x,y), (x+a,y+b)]的和m = r[x+a][y+b] - r[x+a][y-1] - r[x-1][y+b] + r[x-1][y-1]
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        //注意观察数据范围，数据范围小，故可直接用一个数组来存储所有坐标
        int[][] r = new int[1001][1001];
        for (int i = 1;i <= n;i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            r[x][y]++;
        }
        //求每个位置的二维前缀和
        for (int x = 1;x <= 1000;x++) {
            for (int y = 1;y <= 1000;y++) {
                r[x][y] = r[x-1][y] + r[x][y-1] - r[x-1][y-1] + r[x][y];
            }
        }
        int max = 0;
        //枚举矩形左上角。注意a和b的长度可能直接超过了矩阵范围，故还是要枚举所有点
        for (int x = 1;x <= 1000;x++) {
            for (int y = 1;y <= 1000;y++) {
                int a1 = a, b1 = b;
                if (x+a1 > 1000) a1 = 1000-x;
                if (y+b1 > 1000) b1 = 1000-y;
                //注意所求的矩形区域包含左上边界
                max = Math.max(max, r[x+a1][y+b1] - r[x+a1][y-1] - r[x-1][y+b1] + r[x-1][y-1]);
            }
        }
        System.out.println(max);
    }
}
